<template>
<view>
<!--<import src="../../../utils/wxParse/wxParse.wxml"></import>-->
<view class="container">
  <view class="type-navbar">
    <view v-for="(item, index) in categories" :key="index" class="type-box">
      <view :id="item.id" :class="'type-navbar-item ' + (activeCategoryId == item.id ? 'type-item-on' : '')" @tap="tabClick">
        {{item.name}}
      </view>
    </view>
  </view>
  <view class="goods-detail">
    <!-- 商品首页 -->
    <view class="goods-info" :hidden="activeCategoryId==0?false:true">
      <swiper class="swiper_box" indicator-dots="true" vertical="false" autoplay="true" :interval="3000" :duration="1000">
        <block v-for="(item, index) in data.goods.goods_images" :key="index">
          <swiper-item>
            <image class="wh100" :src="url + item.image_url" :data-src="url + item.image_url" @tap.stop="look"></image>
          </swiper-item>
        </block>
      </swiper>
      <navigator class="prom-info" v-if="select.activity.prom_type == 6" :url="'../../team/team_info/team_info?goods_id=' + select.activity.goods_id + '&team_id=' + select.activity.team_id + '&item_id=' + select.activity.item_id">
        <text class="prom-type">{{select.activity.countName}}</text>
        <view>点击前往</view>
      </navigator>
      <view class="goods-title pd-bg-fff">
        <view class="goods-name ellipsis-2">{{data.goods.goods_name}}</view>
        <view class="share-btn" @tap.stop="catchShare" :hidden="!showStore">
          <image src="/static/images/icon-share.png"></image>
          <view>分享</view>
        </view>
      </view>

      <!-- 加载模板,区分正常商品和预约商品内容 -->
      <!--<import src="./goodsInfoTpl/goodsInfoTpl.wxml"></import>-->
      <block v-if="data.goods.is_virtual == 2">
        <block data-type="template" data-is="ordered" data-attr="data:data">
  <view class="book_label">
    <view class="book_price">
      <text class="span b">￥{{data.goods.shop_price}}</text>
      <text class="span">到店价格:<text class="i">￥{{data.goods.market_price}}</text></text>
    </view>
    <view class="book_peop">
      <view class="span">
        <view>已有
          <text class="i">{{data.goods.order_bespeak_count  + data.goods.virtual_comment_count}}</text>人预约
          <view class="em">{{data.goods.invalid_refund==1?"过期不退":"随时退"}}</view>
        </view>

      </view>
    </view>
  </view>
  <view class="book_storinf">
    <view class="book_storinf_item">
      <label>可预约时间</label>
      <text class="span">{{data.goods.bespeak_template.week_day}}</text>
    </view>
    <view class="book_storinf_item">
      <label>店内设施</label>
      <view class="book-sec-item">
        <view v-for="(item, index) in data.goods.bespeak_template.equipment_arr" :key="index" style="margin-left:15rpx;">
          {{item}}
        </view>
      </view>
    </view>
  </view>

</block>
      </block>

      <block v-else>
        <block data-type="template" data-is="default" data-attr="select:select,url:url,data:data,exchange_integral_price:exchange_integral_price,address:address,shipping:shipping,goodsInputNum:goodsInputNum,auto_service_date:auto_service_date,activityIn:activityIn,isSeparate:isSeparate,cardList:cardList">
  <view class="goods-price pd-bg-fff">
    <view class="co-red" v-if="data.goods.exchange_integral>0">
      <text>{{select.activity.priceName}}</text> ￥{{exchange_integral_price}} + {{data.goods.exchange_integral}}积分
    </view>
    <view class="co-red co-red-price" v-else>
      <view class="money-icon">￥</view> 
      <view class="sbj" style="line-height:52rpx">{{select.price[0]}}</view>
      <view class="money-icon">.{{select.price[1]}}</view>
    </view>
    <view class="market-price" v-if="select.activity.prom_type && select.activity.prom_type != 6">
      市场价:
      <view>￥{{select.activity.market_price}}</view>
    </view>
    <view class="market-price" v-else>
        <view>
             市场价
             <text style="text-decoration:line-through"> ￥{{data.goods.market_price}}</text>
        </view>   
       <!--  <view>
            销量 :
            <text> {{data.goods.sales_sum+data.goods.virtual_sales_sum}}</text>
        </view>
        <view>
             库存 :
             <text> {{data.goods.store_count}}</text>
        </view>        -->
    </view>
  </view>
  <view class="prom-info" v-if="select.activity.prom_type && select.activity.prom_type != 6 && isSeparate">
    <text class="prom-type">{{select.activity.countName}}</text>
    <text style="float:right;" class="prom-type">{{select.activity.countTime}}</text>
  </view>
  <view style="width:300rpx;padding-bottom:8rpx;margin-left:30rpx;" class="flex">
    <view class="co-red flex" style="margin-right:10px;line-height:100%;" v-if="data.goods.give_integral > 0">
      赠送<view>{{data.goods.give_integral}}</view>积分</view>

    <view class="goods-num" v-if="select.activity.prom_type!=2">
    </view>
  </view>
<!-- 广告 -->
<view v-if="data.goods.goods_config.ad_code" class="ad-goods user-comment">
  <image mode="widthfix" class="spec-img" :src="url+data.goods.goods_config.ad_code"></image>
</view>
    <view style="width:710rpx;padding:0 20rpx;border-top:16rpx solid #F5F5F5;border-bottom:2rpx solid #f3f3f3;" class="logistics-item" @tap="getCardList" v-if="cardList.length > 0 && data.goods.prom_type != 4">
      <view class="item-title ellipsis-1">优惠券</view>
        <view class="promotion-item-mes-card">
            <view v-for="(item, index) in cardList" :key="index" :for-key="index" v-if="index < 2">
            <text class="promotion-item-mes-cardborder">满{{item.condition}}减{{item.money}}</text>           </view>
      </view>
      <view class="item-img">
        <image class="wh100" src="/static/images/icon-arrowdown.png"></image>
      </view>
    </view>


  <view class="logistics-list pd-bg-fff">
    <view style="width:730rpx" class="logistics-item" v-if="select.activity.prom_type == 8 && select.activity.bargain_list.length > 0">
      <view style="width:270rpx">邀请好友去砍价吧~</view>
      <view class="item-mes bargin_headpic">
        <block v-for="(item, index) in select.activity.bargain_list" :key="index">
          <image class="bargin_head_pic" :src="item.head_pic"></image>
        </block>
      </view>
      <view class style="word-break:normal;width:160rpx;">{{activityIn||0}}人参与</view>
    </view>
 
    <view v-if="data.prom_order && data.goods.prom_type != 4" class="logistics-item" style="height:auto;align-items:stretch;padding:30rpx 0 0 0;">
      <view class="item-title ellipsis-1">活动</view>
      <view class="promotion-item-mes">
        <view v-for="(item, index) in data.prom_order" :key="index" :for-key="index">
          <view style="width:450rpx;padding-bottom:30rpx;line-height:100%;text-overflow:ellipsis;white-space: nowrap;">
            <text class="promotion-item-mes-border">{{item.name}}</text>
            <text class="prom_detail">{{item.prom_detail}}</text>
          </view>
        </view>
      </view>
    </view>

  </view>


  <view v-if="data.goods.price_ladder.length > 0" class="logistics-list pd-bg-fff">
    <view class="logistics-item-price-ladder" v-if="data.goods.price_ladder.length > 0">
    <view class="tit item-title ellipsis-1">优惠购</view>
        <view style="margin-top:2rpx;width:580rpx;overflow:hidden;">
            <view v-for="(item, index) in data.goods.price_ladder" :key="index" class="man" :for-key="index">
                <text class>{{item.amount}}件</text>
                <text class>{{item.price}}元</text>
            </view>
        </view>
    </view>
  </view>




  <view class="logistics-item" @tap="openSpecModel" style="border-top:16rpx solid #f5f5f5;padding:0 20rpx;">
    <view class="item-title">规格</view>
    <view class="item-mes" style="font-weight: bold;">{{select.specName}} {{goodsInputNum}}件</view>
    <view class="item-img">
      <image class="wh100" src="/static/images/icon-arrowdown.png"></image>
    </view>
  </view>
  <view class="logistics-list pd-bg-fff" style="border-top:16rpx solid #f5f5f5;">

    <view class="logistics-item" @tap="enterAddress" :hidden="data.goods.is_virtual">
      <view class="item-title ellipsis-1">地址</view>
      <view class="item-mes">
        <image style="width:20rpx;height:24rpx;margin-top:32rpx;margin-right:10rpx;" src="/static/images/loc.png"></image>{{address.address ? address.address:'请选择配送地址'}}</view>
      <view class="item-img">
        <image class="wh100" src="/static/images/icon-arrowdown.png"></image>
      </view>
    </view>
    <view class="logistics-item" :hidden="data.goods.is_virtual||select.activity.prom_type==4">
      <view class="item-title">运费</view>
      <view class="item-mes">{{shipping}}</view>
      <view style="height:0" class="item-img">
        <image class="wh100" src="/static/images/icon-arrowdown.png"></image>
      </view>
    </view>
    <view class="logistics-item" v-if="!data.goods.is_virtual && data.goods.exchange_integral <= 0 && select.activity.data" @tap="openPromModal">
      <view class="item-title">
        <text class="prom-item">{{select.activity.data[0].title}}</text>
      </view>
      <view class="item-mes ellipsis-1">{{select.activity.data[0].content}}</view>
      <view class="item-img">
        <image class="wh100" src="/static/images/icon-arrowdown.png"></image>
      </view>
    </view>

    <view class="logistics-item">
                    <view class="item-title">服务</view>
                    <view class="item-mes ellipsis-1">由商城自营发货并提供售后服务</view>
                    <view style="height:0" class="item-img">
                        <image class="wh100" src="/static/images/icon-arrowdown.png"></image>
                    </view>
                    <!-- <icon type="warn" size="16" color="#bbb"/> -->
                </view>
                <!-- <view class="guarantee logistics-item">
                    <view wx:if="{{!data.goods.is_virtual}}"><image class="ico-item" src="../../../images/hdfk.png"></image>{{auto_service_date}}天保修</view>
                    <view><image class="ico-item" src="../../../images/qttk.png"></image>正品保障</view>
                     <view wx:if="{{data.goods.store_free_price}}"><image class="ico-item" src="../../../images/hdfk.png"></image>满{{data.goods.store_free_price}}包邮</view>
                    
                </view> -->
    <!-- <view class="look-detail logistics-item" bindtap="tabGoodsContent">
                    <view class="co-red">查看商品详情</view>
                    <view class="item-img"><image class="wh100" src="../../../images/icon-arrowdown.png" ></image></view>
                </view> -->
  </view>
</block>
      </block>

      <view class="recommend" v-if="combinations.length>0">
        <view class="recommend-title co-red">热门搭配</view>
        <scroll-view scroll-x="true" class="containers-slider-cont" style=" white-space: nowrap; ">
          <view class="collocation">
            <navigator v-for="(item, index) in combinations" :key="index" class="li" :url="'/pages/activity/collocation/collocation?goods_id=' + item['combination_goods'][0]['goods_id'] + '&item_id=' + optionItemId + '&combination_id=' + item.combination_id + '&district_id=' + address.district" open-type="redirect">
              <view class="collocation-li-img">
                <image class="wh100" :src="url + '/api/goods/goodsThumImages?goods_id=' + item['combination_goods'][0]['goods_id'] + '&width=200&height=200'"></image>
              </view>
              <view>
                <text decode="nbsp" class=" ellipsis-2 ">{{item['combination_goods'][0]['goods_name']}}</text>
                <text class="co-red collocation-mar-left">￥{{item['combination_goods'][0]['price'] }}\n</text>
                <view class="collocation-li-title-price">省￥{{item.count_price}}</view>
              </view>
            </navigator>
          </view>
        </scroll-view>
      </view>
      <view class="user-comment logistics-item pd-bg-fff">
        <view class="evaluation">用户评价
          <text>({{data.goods.comment_statistics.total_sum}})</text>
        </view>
        <view @tap="tabComment" class="good-comment">
          好评
          <view class="co-red">{{data.goods.comment_statistics.high_rate}}%</view>
          <view class="item-img">
            <image class="wh100" src="/static/images/icon-arrowdown.png"></image>
          </view>
        </view>
      </view>
      <!-- 评论s -->
      <view class="comment-list">
        <view v-for="(item, cIdx) in comments" :key="cIdx" class="comment-item">
          <block v-if="item.goods_rank>=4">
            <view class="comment-title">
              <view class="user-name">
                <view class="user-pic">
                  <image class="wh100" :src="item.is_anonymous ? defaultAvatar : item.head_pic ? item.head_pic : defaultAvatar"></image>
                </view>
                <text class="user-word"> {{item.is_anonymous ? '匿名用户' : item.username}}</text>
                <view class="stars">
                  <view class="stars-checked">
                    <image v-for="(item, index) in item.goods_rank" :key="index" class="star" src="/static/images/star-red.png"></image>
                  </view>
                  <view class="stars-unchecked">
                    <image v-for="(item, index) in 5-item.goods_rank" :key="index" class="star" src="/static/images/star-gray.png"></image>
                  </view>
                </view>
              </view>
              <view class="time">{{item.addTimeFormat}}..{{item.comment_statistics.high_sum}}</view>
            </view>
            <view class="comment-cont">
              <view class="comment-mes">{{item.content}}</view>
              <view class="img-ul">
                <view v-for="(item, index) in item.img" :key="index" class="img-li">
                  <image class="wh100" :src="item" @tap="previewCommentImgs" :data-cidx="cIdx" :data-id="index"></image>
                </view>
              </view>
            </view>
          </block>

        </view>
      </view>
      <!-- 评论e -->
      <!-- 问大家-s -->
      <view class="user-comment asking" @tap="goask" :data-url="'/pages/goods/goodinfo_ask/goodinfo_ask?goods_id=' + good_id" data-id="id">
        <view class="asktitle">
          <text>问大家({{ask_number}})</text>
          <view>
            <text>查看全部</text>
            <image src="/static/images/icon-arrowdown.png"></image>
          </view>
        </view>
        <view class="problem">
          <view v-for="(item, index) in ask_all" :key="index" v-if="index<3">
            <view class="left">
              <text>问</text>{{item.question.content}}
            </view>
            <view class="right">{{item.comment_total}}个回答</view>
          </view>
        </view>
      </view>
      <!-- 问大家-e -->
      <view class="recommend" v-if="data.recommend_goods.length>0">
        <view class="recommend-title">为你推荐</view>
        <view class="recommend-ul">
          <navigator v-for="(item, index) in data.recommend_goods" :key="index" v-if="index < 6" class="li" :url="'/pages/goods/goodsInfo/goodsInfo?goods_id=' + item.goods_id" open-type="redirect">
            <view class="li-img">
              <image style="width:226rpx" class="wh100" :src="url + '/api/goods/goodsThumImages?goods_id=' + item.goods_id + '&width=200&height=200'"></image>
            </view>
            <view class="li-title ellipsis-2">{{item.goods_name}}</view>
            <view class="co-red">
              <text>￥</text>{{item.shop_price}}</view>
          </navigator>
        </view>
      </view>

    </view>
    <!-- 商品详情 -->
    <view class="goods-norms" :hidden="activeCategoryId!=2?false:true">
      <view class="type-navbar2">
        <view v-for="(item, index) in categories2" :key="index" class="type-box2">
          <view :id="item.id" :class="activeCategoryId2 == item.id ? 'type-item2-on' : ''" @tap="tabClick2">
            {{item.name}}
          </view>
        </view>
      </view>
      <view :hidden="activeCategoryId2==0?false:true" class="wxParse">
        <jyf-parser :html="article_content"></jyf-parser>
      </view>
      <view class="parameter" :hidden="activeCategoryId2==1?false:true">
        <view class="table">
          <view class="th-thitle tb">主体</view>
          <view v-for="(item, index) in goodsAttrs" :key="index" class="td-cont tb">
            <view class="td-title">{{item.attr_name}}</view>
            <view class="td-text">{{item.attr_value}}</view>
          </view>
        </view>
      </view>
    </view>
    <!-- 商品评论 -->
    <view class="goods-comment" :hidden="activeCategoryId==2?false:true">
      <view class="type-navbar3">
        <view v-for="(item, index) in categories3" :key="index" class="type-box3">
          <view :id="item.id" :class="activeCategoryId3 == item.id ? 'type-item3-on' : ''" @tap="tabClick3">
            {{item.name}}({{item.num}})
          </view>
        </view>
      </view>
      <view class="comment-list">
        <view v-for="(item, cIdx) in comments" :key="cIdx" class="comment-item">
          <view class="comment-title">
            <view class="user-name">
              <view class="user-pic">
                <image class="wh100" :src="item.is_anonymous ? defaultAvatar : item.head_pic ? item.head_pic : defaultAvatar"></image>
              </view>
              <text class="user-word"> {{item.is_anonymous ? '匿名用户' : item.username}}</text>
              <view class="stars">
                <view class="stars-checked">
                  <image v-for="(item, index) in item.goods_rank" :key="index" class="star" src="/static/images/star-red.png"></image>
                </view>
                <view class="stars-unchecked">
                  <image v-for="(item, index) in 5-item.goods_rank" :key="index" class="star" src="/static/images/star-gray.png"></image>
                </view>
              </view>
            </view>
            <view class="time">{{item.addTimeFormat}}</view>
          </view>
          <view class="comment-cont">
            <view class="comment-mes">{{item.content}}</view>
            <view class="img-ul">
              <view v-for="(item, index) in item.img" :key="index" class="img-li">
                <image class="wh100" :src="item" @tap="previewCommentImgs" :data-cidx="cIdx" :data-id="index"></image>
              </view>
            </view>
          </view>
        </view>

      </view>
    </view>
  </view>
</view>
<!-- 返回顶部按钮  -->
<!-- 加入购物车栏  -->
<view class="join-cart">
  <view class="flex_bottom">
    <view class="custom-service cart-ico">
      <button v-if="imChoose==1" open-type="contact" class="cs-button" :session-from="'wechat|' + userInfo.user_id + '|' + userInfo.nickname + '|' + userInfo.head_pic">
        <image class="cs-img cs-img-kf" src="/static/images/custom-service.png"></image>
        <view class="cs-ing-name">客服</view>
      </button>
      <button v-if="imChoose==0" open-type="contact" class="cs-button">
        <image class="cs-img cs-img-kf" src="/static/images/custom-service.png"></image>
        <view class="cs-ing-name">客服</view>
      </button>
      <view v-else class="cs-button">
        <image class="cs-img cs-img-kf" src="/static/images/custom-service.png"></image>
        <view class="cs-ing-name">客服</view>
      </view>
    </view>
    <view class="goods-collect" @tap="collectGoods">
      <view class="collect-img">
        <image :hidden="data.collect" class="wh100" src="/static/images/heart.png"></image>
        <image :hidden="!data.collect" class="wh100" src="/static/images/heart-h.png"></image>
      </view>
      <view class="collect-des">收藏</view>
    </view>
    <view class="shopping-cart cart-ico">
      <navigator @tap.stop="tocart">
        <image class="sc-img" src="/static/images/shopping-cart.png"></image>
        <view v-if="cartGoodsNum>0" class="cart-num ellipsis-1"> {{cartGoodsNum
          <=99?cartGoodsNum:>
            </text>undefined</tag>
      </text></view></navigator>
      </view>
    </view>

    <view v-if="data.goods.is_virtual >0 && data.goods.is_virtual != 2" class="buy-btn cart-btn cart-btn-lg" @tap="openSpecModel">立即购买</view>
    <view v-else-if="data.goods.is_virtual == 2" class="buy-btn cart-btn cart-btn-lg" @tap="openSpecModel">立即预约</view>
    <view v-else-if="select.activity.prom_type == 4" class="buy-btn cart-btn cart-btn-lg" @tap="openSpecModel">立即预订</view>

    <block v-else-if="select.activity.prom_type == 8">
      <view>
        <view class="join-btn cart-btn " @tap="openSpecModelBargain" data-a="1" :data-listidx="specSelect">单独购</view>
        <view class="classname">￥{{data.goods.spec_goods_price.length > 0 ?data['goods']['spec_goods_price'][specSelect]['price']:data.goods.shop_price}}</view>
      </view>
      <view>
        <view class="buy-btn cart-btn " @tap="openSpecModelBargain" data-a="2" :data-listidx="specSelect">砍价拿</view>
        <view class="classname">￥{{select.activity.prom_type == 8?select.bargain_price:select.price}}</view>
      </view>
    </block>

    <block v-else-if="data.goods.exchange_integral <= 0">
      <view class="join-btn cart-btn" data-type="add" @tap="openSpecModel">加入购物车</view>
      <view class="buy-btn cart-btn" data-type="buy" @tap="openSpecModel">立即购买</view>
    </block>
    <view v-else-if="data.goods.exchange_integral > 0" class="buy-btn cart-btn cart-btn-lg" @tap="openSpecModel">立即兑换</view>
  </view>
  <!-- 规格弹框  -->
  <view :hidden="!openSpecModal">
    <view class="cover-layer" @tap="closeSpecModal"></view>
    <view :animation="ani" class="spec-model" :style="data.goods.spec.length >3 ? 'height:500px;':''">
      <icon type="cancel" color="gray" size="22" class="modal-close" @tap="closeSpecModal"></icon>
      <view class="spec-goods">
        <image class="wh100 spec-img" :src="select.spec_img"></image>
        <view class="spec-goods-info">
          <view class="spec-goods-name">{{data.goods.goods_name}}</view>
          <view class="co-red" v-if="data.goods.exchange_integral>0">
            <text>{{select.activity.priceName}}</text> ￥{{exchange_integral_price}} + {{data.goods.exchange_integral}}积分
          </view>
          <view class="spec-goods-price" v-else>
            <view class="money-icon" style="margin-top:-4rpx;">￥</view>
            <view class="sbj">{{select.price[0]}}.</view>
            <view class="money-icon icon2">{{select.price[1]}}</view>
          </view>
          <view class="spec-goods-stock">剩余库存：{{select.stock}}</view>
        </view>
      </view>

      <block v-for="(item, listIdx) in data.goods_spec_list" :key="listIdx">
        <view class="spec-name">{{item.name}}</view>
        <view class="spec_types">
          <view v-for="(spec, index) in item.spec_item" :key="index" :class="'spec-btn ' + (item.selectItemId==spec.id?'spec-btn-click':'')" @tap="selectSpec" :data-listidx="listIdx" :data-itemid="spec.id">{{spec.item}}</view>
        </view>
      </block>
      <view class="spec-box">
        <view class="spec-name">数量</view>
        <view class="count">
          <view class="sub" @tap="subCartNum">-</view>
          <input type="number" :value="goodsInputNum" @blur="inputCartNum"></input>
          <view class="add" @tap="addCartNum">+</view>
        </view>

      </view>
      <view class="spec-cart-btns">
        <view v-if="data.goods.is_virtual >0 && data.goods.is_virtual != 2" :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" data-action="buy" @tap="addCart">立即购买</view>
        <block v-else-if="select.activity.prom_type == 8">
          <!--     <view wx:if="{{!isSeparate}}" class="spec-cart-btn  spec-cart-btn-lg {{select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':''}}" data-action='add' bindtap="addCart" style="background-color:#ffb03f;margin-left:34rpx;">加入购物车</view>                                              
                <view wx:if="{{!isSeparate}}" class="spec-cart-btn  spec-add-cart {{select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':''}}" data-action='add' bindtap="addCart" style="background-color:#ffb03f;">加入购物车</view>   
                 -->
          <view :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" @tap="bargainBuy" data-action="add" :data-status="isSeparate">{{isSeparate?'砍价拿':'加入购物车'}}</view>
        </block>
        <view v-else-if="data.goods.is_virtual == 2" :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" data-action="buy" @tap="addCart">立即预约</view>
        <view v-else-if="select.activity.prom_type == 4" :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" data-action="reserve" @tap="addCart">立即预订</view>
        <block v-else-if="data.goods.exchange_integral <= 0">
          <!-- <view class="spec-cart-btn spec-add-cart {{select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':''}}" data-action='add' bindtap="addCart" wx:if="showCar">加入购物车</view> -->
          <view :class="'spec-cart-btn spec-buy ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" :data-action="addCartType" @tap="addCart">确定</view>
        </block>
        <view v-else :class="'spec-cart-btn spec-buy spec-cart-btn-lg ' + (select.stock<=0||shippingCost<0||!hasSpec?'spec-cart-disable':'')" data-action="exchange" @tap="addCart">立即兑换</view>
      </view>
    </view>
  </view>
  <!-- 优惠信息弹框  -->
  <view :hidden="!openPromModal">
    <view class="cover-layer" @tap="closePromModal"></view>
    <view class="prom-model">
      <icon type="cancel" color="gray" size="22" class="modal-close" @tap="closePromModal"></icon>
      <view class="prom-title">优惠信息</view>
      <view v-for="(item, index) in select.activity.data" :key="index" class="logistics-item">
        <view class="item-title">
          <text class="prom-item">{{item.title}}</text>
        </view>
        <view class="item-mes ellipsis-1">{{item.content}}</view>
      </view>
    </view>
  </view>
  <!-- 分享选择 -->
  <view v-if="share_btn" class="share-select">
    <view class="cover-layer" @tap="closePromModal"></view>
    <view class="share-containter">
      <view class="share-tit">分享到</view>
      <view class="share-content">
        <button class="action-sheet" open-type="share">
          <view class="shart-item">
            <image src="/static/images/wx_friend.png"></image>
            <view>微信好友</view>
          </view>
        </button>
        
        <view class="shart-item">
          <image @tap.stop="getSharePic" src="/static/images/generate.png"></image>
          <view>生成图片</view>
        </view>
      </view>
      <view @tap="share_cancel" class="share-tit share-cancel">取消</view>
    </view>
  </view>
  <!-- 分享海报生成 -->
  <view :hidden="actionSheetHidden">
    <view class="cover-layer" @tap="closePromModal"></view>
    <view class="posters-model">
          <image mode="widthFix" @tap.stop="previewSharePic" :src="share_pic"></image>
          <view @tap.stop="saveSharePic" class="save-image">保存图片</view>
    </view>
  </view>
</view>
</template>

<script>
var util = require("../../../utils/util.js");
var common = require("../../../utils/common.js");

var app = getApp();
var request = app.globalData.request;
var setting = app.globalData.setting;

export default {
  data() {
    return {
      url: setting.url,
      resourceUrl: setting.resourceUrl,
      defaultAvatar: setting.resourceUrl + "/static/static/images/user68.jpg",
      data: null,
      //请求的商品详情数据
      result: null,
      content: '',
      //商品详情页html
      goodsAttrs: null,
      //商品属性列表
      cartGoodsNum: 0,
      //购物车商品数量
      specSelect: 0,
      //选中的组合规格数组spec_goods_price下标
      optionItemId: 0,
      //页面参数，页面初始化指定显示的itemid，用于活动
      goodsInputNum: 1,
      //选中的商品件数
      openSpecModal: false,
      //是否打开规格弹窗
      openPromModal: false,
      //是否打开优惠信息弹窗
      activeCategoryId: 0,
      //商品主页tab
      supportPageScroll: false,
      //微信版本是否支持页面滚动回顶部
      address: {
        address: '',
        district: 0
      },
      shipping: '',
      shippingCost: 0,
      hasSpec: true,
      enterAddressPage: false,
      categories: [{
        name: "商品",
        id: 0
      }, {
        name: "详情",
        id: 1
      }, {
        name: "评论",
        id: 2
      }],
      activeCategoryId2: 0,
      //商品内容tab
      categories2: [{
        name: "商品详情",
        id: 0
      }, {
        name: "规格参数",
        id: 1
      }],
      activeCategoryId3: 0,
      //商品评论tab
      categories3: [{
        name: "全部",
        id: 0,
        num: 0
      }, {
        name: "好评",
        id: 1,
        num: 0
      }, {
        name: "中评",
        id: 2,
        num: 0
      }, {
        name: "差评",
        id: 3,
        num: 0
      }, {
        name: "有图",
        id: 4,
        num: 0
      }],
      select: {
        //选择的(规格)商品的参数，用于显示
        price: 0,
        stock: 0,
        specName: '',
        activity: null
      },
      timer: null,
      //活动倒计时定时器
      imChoose: 0,
      //0 QQ客服,1 IM客服,2 小能客服
      imgs: [],
      //商品图片组
      options: null,
      share_btn: false,
      //自定义分享按钮状态
      actionSheetHidden: true,
      //自定义actionSheet隐藏True
      activityIn: 0,
      isBragain: false,
      isSeparate: true,
      cardList: [],
      combinations: [],
      //搭配购
      ask_all: [],
      //问大家
      ask_number: [],
      //问答数
      good_id: "",
      shoppingcard_id: "",
      maskShow: true,
      showCar: false,
      showYes: false,
      showStore: false,
      domHeight: 0,
      userInfo: "",
      auto_service_date: "",
      point_rate: "",
      exchange_integral_price: "",
      comments: "",
      ani: "",
      addCartType: "",
      share_pic: "",
      article_content: ""
    };
  },

  components: {},
  props: {},
  onLoad: function (options) {
    if (options.scene) {
      var scene = decodeURIComponent(options.scene);
      var data = scene.split('&');
      options.goods_id = data[0].split('=')[1];
      options.item_id = data[1].split('=')[1];
      options.first_leader = data[2].split('=')[1];
    }

    var that = this;

    if (options.first_leader) {
      uni.setStorageSync('first_leader', options.first_leader);
    }

    var userInfo = uni.getStorageSync('app:userInfo');
    that.setData({
      userInfo: userInfo
    });
    app.globalData.getConfig(function (res) {
      var im_choose = common.getConfigByName(res.config, 'im_choose');
      var guarantee = common.getConfigByName(res.config, 'auto_service_date');
      var point_rate = common.getConfigByName(res.config, 'point_rate');
      that.setData({
        imChoose: im_choose,
        auto_service_date: guarantee,
        point_rate: point_rate
      });
    });
    that.optionItemId = typeof options.item_id == 'undefined' ? 0 : options.item_id;
    request.get('/api/goods/goodsInfo', {
      data: {
        id: options.goods_id
      },
      failRollback: true,
      isShowLoading: false,
      success: function (res) {
        that.setData({
          result: res.data.result,
          data: res.data.result,
          good_id: options.goods_id
        });
        that.initData(res.data.result);
        that.requestGoodsContent();
        that.getUserAddress(res.data.result);
        that.requestCardList();
      }
    });
    that.requestCardNum(); //是否支持返回按钮

    if (uni.pageScrollTo) {
      that.setData({
        supportPageScroll: true
      });
    }

    if (app.globalData.is_apply != 1) {
      that.setData({
        showStore: true
      });
    } // 问大家


    request.get('/api/user/ask_all', {
      data: {
        id: options.goods_id,
        type: 'simple'
      },
      failRollback: true,
      isShowLoading: false,
      success: function (res) {
        that.setData({
          ask_all: res.data.result,
          ask_number: res.data.question_total
        });
      }
    });
  },
  //重新刷新物流数据
  onShow: function () {
    if (this.enterAddressPage) {
      this.enterAddressPage = false;
      this.getUserAddress(this.result);
    }
  },
  onUnload: function () {
    this.destroyActivityTimer();
  },

  /**
   * 转发按钮
   */
  onShareAppMessage: function (res) {
    var that = this;
    var goods = that.data.goods;
    var url = that.url;
    return {
      title: goods.goods_name,
      //自定义转发标题
      path: '/pages/goods/goodsInfo/goodsInfo?goods_id=' + goods.goods_id + '&item_id=' + that.optionItemId + '&first_leader=' + uni.getStorageSync('app:userInfo')['user_id'],
      imageUrl: goods.original_img ? url + goods.original_img : url + goods.spec_goods_price[0].spec_img
    };
  },
  methods: {
    // 问大家
    goask: function (e) {
      uni.navigateTo({
        url: e.currentTarget.dataset.url
      });
    },

    /**查询商品物流 */
    refreshDispatch: function (result, consigneeAddress) {
      var that = this;
      that.setData({
        'address.address': consigneeAddress.address2 || consigneeAddress.address,
        'address.district': consigneeAddress.district
      });
      request.get('/api/goods/dispatching', {
        data: {
          goods_id: result.goods.goods_id,
          region_id: consigneeAddress.district
        },
        isShowLoading: false,
        success: function (res) {
          var shippinginfo;

          if (res.data.result.freight > 0) {
            shippinginfo = '￥' + res.data.result.freight;
            that.setData({
              shippingCost: res.data.result.freight
            });
          } else if (res.data.result.freight == 0) {
            shippinginfo = '包邮';
            that.setData({
              shippingCost: res.data.result.freight
            });
          } else {
            shippinginfo = res.data.msg;
            that.setData({
              shippingCost: -1
            });
          }

          that.setData({
            shipping: shippinginfo
          });
        },
        failStatus: function (res) {
          if (res.data.status == 0) {
            that.setData({
              shipping: res.data.msg
            });
            that.setData({
              shippingCost: -1
            });
            app.globalData.showTextWarining(res.data.msg);
          }

          return false;
        }
      });
    },
    enterAddress: function () {
      this.enterAddressPage = true;
      uni.navigateTo({
        url: '/pages/user/address_list/address_list?operate=selectAddress'
      });
    },

    /** 初始化数据，注意顺序 */
    initData: function (data) {
      //获取推荐商品
      this.getRecommendGoods(data); //初始化评论

      this.initComment(data); //检查商品

      this.initCheckGoods(data); //初始化规格
      //this.initSpecsPrice(data);
      //检查一下购物的数量，可能无库存
      //this.checkCartNum(this.data.goodsInputNum);
      //处理商品轮播图片

      this.goodsImages(data);
    },
    getCombination: function (data, item_id) {
      var that = this;
      request.post('/Home/Goods/combination', {
        data: {
          goods_id: data.goods.goods_id,
          item_id: item_id ? item_id : that.optionItemId
        },
        isShowLoading: false,
        success: function (res) {
          that.setData({
            combinations: res.data.result || []
          });
        }
      });
    },

    /** 商品图片组 */
    goodsImages: function (data) {
      var img = data.goods.goods_images;
      var imgs = [];

      for (var i = 0; i < img.length; i++) {
        imgs.push(this.url + img[i]['image_url']);
      }

      this.setData({
        imgs: imgs
      });
    },

    /** 查看图片 */
    look: function (e) {
      uni.previewImage({
        current: e.currentTarget.dataset.src,
        // 当前显示图片的http链接
        urls: this.imgs // 需要预览的图片http链接列表

      });
    },

    /** 检查商品 */
    initCheckGoods: function (data) {
      var that = this;
      var item_id = data.goods.spec_goods_price.length > 0 ? data.goods.spec_goods_price[0]['item_id'] : '';

      if (that.optionItemId) {
        item_id = that.optionItemId;
      }

      request.get('/api/goods/activity', {
        data: {
          goods_id: data.goods.goods_id,
          item_id: item_id
        },
        isShowLoading: false,
        success: function (res) {
          //初始化规格
          if (res.data.result.goods.activity_is_on == 1) {
            that.initSpecsPrice(res.data.result);
          } else {
            data.goods.prom_type = 0;
            that.initSpecsPrice(data);
          }
        }
      });
    },

    /** 获取该分类推荐商品 */
    getRecommendGoods: function (data) {
      var that = this;
      request.get('/api/goods/recommendGoods', {
        data: {
          cat_id: data.goods.cat_id
        },
        isShowLoading: false,
        success: function (res) {
          that.data.recommend_goods = res.data.result || [];
          that.setData({
            data: that.data
          });
        }
      });
    },

    /** 获取用户地址 */
    getUserAddress: function (result) {
      var that = this;
      var consigneeAddress = uni.getStorageSync('goodsInfo:goodsInfo:address');

      if (consigneeAddress) {
        if (that.data.goods.is_virtual != 1) {
          that.refreshDispatch(result, consigneeAddress);
        }
      } else {
        request.post('/api/goods/getDefaultAddress', {
          data: {
            goods_id: result.goods.goods_id
          },
          isShowLoading: false,
          success: function (res) {
            if (that.data.goods.is_virtual != 1) {
              that.refreshDispatch(result, res.data.result);
            }
          }
        });
      }
    },

    /** 初始化评论相关 */
    initComment: function (data) {
      //好评率
      data.goods.goodCommentRate = data.goods.comment_statistics.total_sum > 0 ? data.goods.comment_statistics.high_rate : 0; //评论数

      this.categories3[0].num = data.goods.comment_statistics.total_sum;
      this.categories3[1].num = data.goods.comment_statistics.high_sum;
      this.categories3[2].num = data.goods.comment_statistics.center_sum;
      this.categories3[3].num = data.goods.comment_statistics.low_sum;
      this.categories3[4].num = data.goods.comment_statistics.img_sum; //渲染视图

      this.setData({
        categories3: this.categories3,
        data: data
      });
    },

    /** 初始化所有规格 */
    initSpecsPrice: function (data) {
      var specSelect = 0; //初始化选中第一个规格 

      var specs = this.data.goods.spec_goods_price;

      if (specs.length == 0) {
        //没有规格
        this.initActivity(data.goods); //检查一下购物的数量，可能无库存

        this.checkCartNum(this.goodsInputNum); //获取搭配购活动商品

        this.getCombination(data);
        return;
      } //第一次请求的总数据中的activity默认是第一种规格的,可减少一次请求
      //specs[0].activity = data.goods; 


      if (this.optionItemId) {
        //指定规格
        for (var i = 0; i < specs.length; i++) {
          if (specs[i].item_id == this.optionItemId) {
            specSelect = i;
            break;
          }
        }
      } else {
        //初始化选库存不为0的规格
        for (var i = 0; i < specs.length; i++) {
          if (specs[i].store_count <= 0) {
            continue;
          }

          specSelect = i;
          break;
        }
      } //specs[specSelect].activity = data.goods;
      //生成子规格组(goods_spec_list)的各自选中项


      var specIds = specs[specSelect].key.split("_");
      var list = this.data.goods.spec;

      for (var i = 0; i < list.length; i++) {
        for (var j = 0; j < list[i].spec_item.length; j++) {
          if (util.inArray(list[i].spec_item[j].id, specIds)) {
            list[i].selectItemId = list[i].spec_item[j].id;
            break;
          }
        }
      }

      this.setData({
        specSelect: specSelect,
        'data.goods_spec_list': list,
        'data.goods.spec_goods_price': specs
      }); //获取搭配购活动商品

      this.getCombination(data, specs[specSelect].item_id); //检查一下购物的数量，可能无库存

      this.checkCartNum(this.goodsInputNum);
      this.initSelectSpecGoods();
    },

    /** 初始化选中的规格商品 */
    initSelectSpecGoods: function () {
      var specSelect = this.specSelect;
      var specs = this.data.goods.spec_goods_price;
      var itemId = specs[specSelect].item_id;

      if (specs[specSelect].prom_type == 0 || specs[specSelect].prom_type == 7) {
        var noActivity = {
          prom_type: 0
        };
        this.initActivity(noActivity);
      } else if (typeof specs[specSelect].activity != 'undefined') {
        this.initActivity(specs[specSelect].activity);
      } else {
        this.requestSpecInfo(specSelect);
      }
    },

    /** 请求规格商品的活动信息 */
    requestSpecInfo: function (specSelect) {
      var that = this;
      var specs = this.data.goods.spec_goods_price;
      request.get('/api/goods/activity', {
        data: {
          goods_id: this.data.goods.goods_id,
          item_id: specs.length > 0 ? specs[specSelect].item_id : ''
        },
        isShowLoading: false,
        success: function (res) {
          if (res.data.result.goods.activity_is_on == 1) {
            that.initActivity(res.data.result.goods);
          } else {
            that.initActivity(that.data.goods);
          }
        }
      });
    },

    /** 初始化显示的活动信息 */
    initActivity: function (activity) {
      if (activity.prom_type && activity.prom_type != 6) {
        var startTime = new Date().getTime();

        if (activity.prom_type == 1) {
          //抢购
          activity.priceName = '抢购价';
          activity.countName = '限时抢购';
        } else if (activity.prom_type == 2) {
          //团购
          activity.priceName = '团购价';
          activity.countName = '限时团购';
        } else if (activity.prom_type == 3) {
          //促销
          activity.countName = '优惠促销';
        } else if (activity.prom_type == 4) {
          //预售
          activity.priceName = '预售价';
          activity.countName = '预售';
        } else if (activity.prom_type == 8) {
          //砍价
          !this.isBragain ? activity.priceName = '砍价享' : activity.priceName = '';
          !this.isBragain ? activity.countName = '砍价活动' : activity.countName = '';
          !this.isBragain && this.barGainShar(activity);
        }

        activity.countTime = '--天--时--分--秒';

        if (!activity.diffTime) {
          activity.diffTime = new Date().getTime() - activity.server_current_time * 1000;
        }
      } else if (activity.prom_type == 6) {
        activity.countName = '该商品正在参与拼团';
        activity.goods_id = activity.goods_id;
        activity.team_id = activity.prom_id ? activity.prom_id : 0;
        activity.item_id = activity.item_id ? activity.item_id : 0;
      }

      this.setData({
        'select.activity': activity
      });
      this.destroyActivityTimer();
      this.createActivityTimer();
      this.initSelectedData();
    },

    /** 初始化选中的（规格）商品的显示参数 */
    initSelectedData: function () {
      var goods = this.data.goods;
      var activity = this.select.activity;
      var specs = this.data.goods.spec_goods_price;
      var specSelect = this.specSelect;
      var stock = 0;
      var price = 0;
      var specImg = "/api/goods/goodsThumImages?goods_id=" + this.data.goods.goods_id + "&width=200&height=200";

      if (activity.prom_type == 1 || activity.prom_type == 2) {
        price = activity.shop_price;
        stock = activity.store_count;
      } else if (activity.prom_type == 3) {
        price = activity.shop_price;
        stock = activity.store_count;
      } else if (activity.prom_type == 4) {
        price = activity.shop_price;
        stock = activity.store_count;
      } else if (activity.prom_type == 8 && !this.isBragain) {
        price = activity.end_price ? activity.end_price : activity.shop_price;
        stock = activity.store_count;
        this.setData({
          'select.bargain_price': price
        });
      } else if (specs.length > 0) {
        price = specs[specSelect].price;
        stock = specs[specSelect].store_count;
      } else {
        price = goods.shop_price;
        stock = goods.store_count;
      }

      if (this.data.goods.exchange_integral > 0) {
        var exchange_integral_price = price - this.data.goods.exchange_integral / this.point_rate;
      }

      if (specs.length > 0) {
        specImg = specs[specSelect].spec_img;

        if (!specImg) {
          specImg = "/api/goods/goodsThumImages?goods_id=" + this.data.goods.goods_id + "&width=200&height=200";
        }
      }

      if (specImg.indexOf('http') < 0 && specImg.indexOf('https') < 0) {
        specImg = this.url + specImg;
      }

      this.setData({
        exchange_integral_price: exchange_integral_price ? exchange_integral_price.toFixed(2) : 0,
        'select.price': parseFloat(price).toFixed(2).split('.'),
        'select.stock': stock,
        'select.specName': specs.length > 0 ? specs[specSelect].key_name : '',
        'select.spec_img': specImg
      });

      if (this.isBragain) {
        this.setData({
          isBragain: false
        });
      }
    },

    /** 获取正在参与砍价人员 */
    barGainShar: function (activity) {
      //参与人数
      if (!activity.bargain) {
        return;
      }

      var list_count = Number(activity.bargain.virtual_num) + Number(activity.bargain_list.length);

      if (list_count >= 10000) {
        list_count = (list_count / 10000).toFixed(1) + '万';
      } //虚拟头像


      var photo = ['https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1788562038,3472846301&fm=27&gp=0.jpg', 'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1091628847,41930541&fm=27&gp=0.jpg', 'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1285622578,302277335&fm=27&gp=0.jpg', 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3893578947,513342183&fm=27&gp=0.jpg', 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1880698741,2631508258&fm=27&gp=0.jpg', 'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3859421672,511986628&fm=200&gp=0.jpg'];

      if (activity.bargain_list.length < 6) {
        for (var y = 0; y < activity.bargain_list.length; y++) {
          var str = activity.bargain_list[y]['head_pic'];

          if (photo.indexOf(str) != -1) {
            return;
          }

          if (activity.bargain_list[y]['head_pic'].indexOf('http') == -1) {
            activity.bargain_list[y]['head_pic'] = this.url + activity.bargain_list[y]['head_pic'];
          }
        }

        if (Number(activity.bargain.virtual_num) + Number(activity.bargain_list.length) >= 6) {
          var le = 6 - activity.bargain_list.length;
        } else {
          var le = activity.bargain.virtual_num;
        }

        if (le > 0) {
          for (var i = 0; i < le; i++) {
            activity.bargain_list.push({
              head_pic: photo[i],
              types: 1
            });
          }
        }
      }

      this.setData({
        'select.activity.bargain_list': activity.bargain_list,
        activityIn: list_count
      });
    },

    /** 检查是否倒计时是否结束 */
    checkActivityTime: function () {
      var that = this;
      var activity = that.select.activity;
      var remainTime = activity.end_time * 1000 - new Date().getTime() + activity.diffTime;

      if (remainTime > 0) {
        remainTime = util.remainTime(remainTime);
        that.setData({
          'select.activity.countTime': remainTime
        });
      } else {
        that.requestSpecInfo(that.specSelect);
        return;
      }
    },

    /** 创建活动倒计时定时器 */
    createActivityTimer: function () {
      var that = this;
      var activity = that.select.activity;

      if (!activity.prom_type || activity.prom_type == 6 || that.isBragain) {
        return;
      }

      that.timer = setInterval(function () {
        that.checkActivityTime();
      }, 1000);
    },

    /** 销毁活动倒计时定时器 */
    destroyActivityTimer: function () {
      if (this.timer) {
        clearInterval(this.timer);
        this.timer = null;
      }
    },

    /** 商品首页 */
    tabClick: function (e) {
      var typeId = e.currentTarget.id;
      this.setData({
        activeCategoryId: typeId
      });

      if (typeId == 1) {
        this.tabGoodsContent();
      } else if (typeId == 2) {
        this.tabComment();
      }
    },

    /** 商品详情页 */
    tabClick2: function (e) {
      this.setData({
        activeCategoryId2: e.currentTarget.id
      });
    },

    /** 评论页 */
    tabClick3: function (e) {
      if (e.currentTarget.id == this.activeCategoryId3) {
        return;
      }

      this.setData({
        activeCategoryId3: e.currentTarget.id
      });
      this.requestComments(this.data.goods.goods_id, e.currentTarget.id);
    },

    /** 请求评论数据 */
    requestComments: function (goodsId, commentType) {
      var that = this;
      commentType++;
      var requestUrl = that.url + '/api/goods/getGoodsComment?goods_id=' + goodsId + '&type=' + commentType;
      request.get(requestUrl, {
        isShowLoading: false,
        success: function (res) {
          var comments = res.data.result;

          for (var i = 0; i < comments.length; i++) {
            comments[i].addTimeFormat = util.formatTime(comments[i].add_time, false);
            comments[i].head_pic = common.getFullUrl(comments[i].head_pic);
          }

          that.setData({
            comments: comments
          });
        }
      });
    },
    tocart: function () {
      var url = '/pages/cart/cart/cart';
      app.globalData.getConfig(function (res) {
        var is_block = common.getConfigByName(res.config, 'is_block_index');

        if (is_block == 0) {
          app.globalData.menu_index = '2';
          common.defaultTotabar('2', -1);
        } else {
          common.customTocart();
        }
      });
    },

    /** 返回顶部 */
    doScrollTop: function () {
      uni.pageScrollTo({
        scrollTop: 0
      });
    },

    /** 打开评论页 */
    tabComment: function () {
      this.setData({
        activeCategoryId: 2
      });

      if (!this.comments) {
        this.requestComments(this.data.goods.goods_id, this.activeCategoryId3);
      }
    },

    /** 打开商品内容页 */
    tabGoodsContent: function () {
      this.setData({
        activeCategoryId: 1
      });
    },

    /** 请求商品详情页嵌入的html内容 */
    requestGoodsContent: function () {
      var that = this;
      request.get('/api/goods/goodsContent', {
        data: {
          id: this.data.goods.goods_id
        },
        // isShowLoading: false,
        success: function (res) {
          //WxParse.wxParse('content', 'html', res.data.result.goods_content, that, 6)
          setTimeout(() => {
            that.article_content = res.data.result.goods_content;
          }, 200); //网页中的图片加上域名

          common.wxParseAddFullImageUrl(that, 'content');
          that.setData({
            goodsAttrs: res.data.result.goods_attr_list
          });
        }
      });
    },

    /** 点击规格按钮的回调函数 */
    selectSpec: function (e) {
      //对商品数量进行判断，对库存进行判断
      var itemId = e.currentTarget.dataset.itemid;
      var listIdx = e.currentTarget.dataset.listidx;
      var list = this.data.goods_spec_list;

      if (list[listIdx].selectItemId == itemId) {
        return;
      }

      list[listIdx].selectItemId = itemId;
      var newSpecKeys = [];

      for (var i = 0; i < list.length; i++) {
        newSpecKeys[i] = list[i].selectItemId;
      } //item排序,生成key


      var newSpecKeys = util.sortSize(newSpecKeys).join('_');
      var newSpecSelect = 0;
      var specs = this.data.goods.spec_goods_price;
      var hasSpec = false;

      for (var i = 0; i < specs.length; i++) {
        if (specs[i].key == newSpecKeys) {
          hasSpec = true;
          newSpecSelect = i;
          break;
        }
      }

      this.setData({
        hasSpec: hasSpec,
        specSelect: newSpecSelect,
        'data.goods_spec_list': list,
        optionItemId: this.data.goods.spec_goods_price[newSpecSelect].item_id,
        isBragain: this.isSeparate ? false : true
      });
      this.getCombination(this.data, this.data.goods.spec_goods_price[newSpecSelect].item_id);
      this.initSelectSpecGoods();
      this.checkCartNum(this.goodsInputNum);
    },

    /** 加入购物车 */
    addCart: function (e) {
      var that = this;
      var itemId = 0;
      var specs = this.data.goods.spec_goods_price; //区分有规格和无规格

      if (specs.length > 0) {
        if (specs[this.specSelect].store_count <= 0) {
          return app.globalData.showTextWarining("当前无库存！");
        }

        itemId = specs[this.specSelect].item_id;
      } else {
        if (this.data.goods.store_count <= 0) {
          return app.globalData.showTextWarining("当前无库存！");
        }
      }

      if (this.goodsInputNum <= 0) {
        return app.globalData.showTextWarining("商品数量不能小于1");
      }

      var data = {
        goods_id: this.data.goods.goods_id,
        goods_num: this.goodsInputNum,
        item_id: itemId
      };

      if (this.data.goods.is_virtual > 0 && this.data.goods.is_virtual != 2) {
        return this.buyVirtualGoods(data);
      }

      if (e.currentTarget.dataset.action == 'add') {
        //加入购物车
        if (this.shippingCost < 0 || this.select.stock <= 0 || !this.hasSpec) {
          return;
        }

        request.post('/api/cart/add', {
          data: data,
          isShowLoading: false,
          success: function (res) {
            that.setData({
              openSpecModal: false
            });
            request.checkUniqueId();
            app.globalData.showSuccess('添加成功', that.requestCardNum());
          }
        });
      } else if (e.currentTarget.dataset.action == 'reserve') {
        //立即预订
        this.reserve(data);
      } else if (e.currentTarget.dataset.action == 'exchange') {
        //立即兑换
        this.exchange(data);
      } else {
        //立即购买
        this.buyNow(data);
      }
    },

    /** 购买虚拟商品 */
    buyVirtualGoods: function (data) {
      //检查用户是否登录方可操作立即购买
      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      Object.assign(data, {
        goods_name: this.data.goods.goods_name,
        spec_name: this.select.specName,
        price: this.select.price
      });
      uni.navigateTo({
        url: '/pages/virtual/buy_step/buy_step?' + util.Obj2Str(data)
      });
    },

    /** 立即预订 */
    reserve: function (data) {
      var that = this; //检查用户是否登录方可操作立即购买

      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      if (this.shippingCost < 0 || this.select.stock <= 0 || !this.hasSpec) {
        return;
      }

      Object.assign(data, {
        action: 'reserve',
        prom_id: that.select.activity.prom_id ? that.select.activity.prom_id : ''
      });
      this.setData({
        openSpecModal: false,
        enterAddressPage: true
      });
      uni.navigateTo({
        url: '/pages/cart/reserve/reserve?' + util.Obj2Str(data)
      });
    },

    /** 立即兑换 */
    exchange: function (data) {
      //检查用户是否登录方可操作立即购买
      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      let that = this;
      that.setData({
        openSpecModal: false,
        enterAddressPage: true
      });
      request.post('/api/cart/buyIntegralGoods', {
        data: data,
        isShowLoading: false,
        success: function (res) {
          if (1 == res.data.status) {
            uni.navigateTo({
              url: '/pages/cart/integral/integral?' + util.Obj2Str(data)
            });
          }
        }
      }); // if (app.userInfo.pay_points < this.data.data.goods.exchange_integral ){
      //     return app.showTextWarining('您的积分不够喔~');
      // }
      // if (this.data.shippingCost < 0 || this.data.select.stock <= 0 || !this.data.hasSpec){
      //     return;
      // }
    },

    /** 立即购买 */
    buyNow: function (data) {
      //检查用户是否登录方可操作立即购买
      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      if (this.shippingCost < 0 || this.select.stock <= 0 || !this.hasSpec) {
        return;
      }

      Object.assign(data, {
        action: 'buy_now'
      });
      this.setData({
        openSpecModal: false,
        enterAddressPage: true
      });
      uni.navigateTo({
        url: '/pages/cart/cart2/cart2?' + util.Obj2Str(data)
      });
    },

    /** 增加购买的商品数量 */
    addCartNum: function (e) {
      this.checkCartNum(this.goodsInputNum + 1);
    },

    /** 减少购买的商品数量 */
    subCartNum: function (e) {
      this.checkCartNum(this.goodsInputNum - 1);
    },

    /** 输入购买的数量 */
    inputCartNum: function (e) {
      this.checkCartNum(Number(e.detail.value));
    },

    /** 检查购买的数量 */
    checkCartNum: function (num) {
      var specs = this.data.goods.spec_goods_price;
      var specSelect = this.specSelect;
      var activity = this.select.activity;
      var stock = this.data.goods.store_count; //参与活动

      if (activity && activity.activity_is_on == 1) {
        stock = activity.store_count;
      } else {
        if (specs.length > 0) {
          stock = specs[specSelect].store_count;
        }
      }

      if (num > stock || stock == 0) {
        num = stock;
      } else if (num < 1) {
        num = 1;
      }

      this.setData({
        goodsInputNum: num
      });
    },

    /** 关闭规格弹窗 */
    closeSpecModal: function () {
      var query = uni.createSelectorQuery(); //选择class

      var that = this;
      var height = 0;
      query.select('.spec-model').boundingClientRect(function (rect) {
        // console.log(rect.width)
        height = rect.height;
        var animation = uni.createAnimation({
          duration: 200,
          timingFunction: 'ease'
        });
        console.log(height);
        animation.translate(0, height).step();
        that.setData({
          ani: animation.export()
        });
        setTimeout(function () {
          that.setData({
            openSpecModal: false
          });
        }, 200);
      }).exec();
    },

    /** 打开规格弹窗 */
    openSpecModel: function (e) {
      this.setData({
        openSpecModal: true,
        isSeparate: true,
        addCartType: e.currentTarget.dataset.type
      });
      var query = uni.createSelectorQuery(); //选择class

      var that = this;
      var height = 0;
      query.select('.spec-model').boundingClientRect(function (rect) {
        // console.log(rect.width)
        height = rect.height;
        var animation = uni.createAnimation({
          duration: 200,
          timingFunction: 'ease'
        });
        console.log(height);
        animation.translate(0, -height).step();
        that.setData({
          ani: animation.export()
        });
      }).exec();
    },

    /** 打开砍价规格弹框 */
    openSpecModelBargain: function (e) {
      var data = e.currentTarget.dataset;
      this.setData({
        openSpecModal: true
      }); //单独购

      if (data.a == 1) {
        this.setData({
          isSeparate: false,
          isBragain: true
        });
      } else {
        // wx.showLoading({mask: true});      
        this.setData({
          isSeparate: true,
          isBragain: false
        });
      }

      this.initActivity(this.data.goods);
    },

    /** 砍价购买 */
    bargainBuy: function (e) {
      var that = this;

      if (!app.globalData.auth.isAuth()) {
        app.globalData.showLoading(null, 1500);
        app.globalData.getUserInfo();
        return;
      }

      var data = e.currentTarget.dataset;

      if (data.status) {
        if (that.shippingCost < 0 || that.select.stock <= 0 || !that.hasSpec) {
          return;
        } //砍价拿


        that.setData({
          openSpecModal: false
        });
        var specs = that.data.goods.spec_goods_price;
        var specSelect = that.specSelect;
        var item_id = specs.length > 0 ? specs[specSelect]['item_id'] : '';

        if (that.select.stock == 0 || Number(that.select.stock) - Number(that.goodsInputNum) < 0) {
          that.setData({
            goodsInputNum: 1
          });
          return app.globalData.showTextWarining('砍价库存不足!');
        }

        uni.showModal({
          content: '确定发起砍价吗?',
          success: function (res) {
            if (res.confirm) {
              //去下单，并且发起砍价活动
              request.post('/api/Bargain/start_bargain', {
                data: {
                  bargain_id: that.select.activity.prom_id,
                  goods_num: that.goodsInputNum,
                  item_id: item_id
                },
                isShowLoading: false,
                success: function (res) {
                  if (1 == res.data.status) {
                    uni.navigateTo({
                      url: '/pages/Bargain/bargain/bargain?id=' + res.data.result.id
                    });
                  } else {
                    app.globalData.showTextWarining(res.data.msg);
                  }
                }
              });
            }
          }
        });
      } else {
        //单独购
        that.addCart(e);
      }
    },
    collectGoods: function () {
      var that = this;
      request.post('/api/goods/collectGoodsOrNo', {
        data: {
          goods_id: that.data.goods.goods_id
        },
        isShowLoading: false,
        success: function (res) {
          app.globalData.showSuccess(res.data.msg);
          that.setData({
            'data.collect': !that.data.collect
          });
        }
      });
    },

    /** 联系客服 */
    contactService: function () {
      app.globalData.getConfig(function (res) {
        var phone = common.getConfigByName(res.config, 'phone');

        if (phone) {
          app.globalData.confirmBox('请联系客服：' + phone, function () {
            uni.makePhoneCall({
              phoneNumber: phone
            });
          });
        }
      });
    },

    /** 请求购物车数量 */
    requestCardNum: function () {
      var that = this;
      request.get('/api/cart/getCartNum', {
        isShowLoading: false,
        success: function (res) {
          that.setData({
            cartGoodsNum: res.data.result
          });
        }
      });
    },

    /** 获取可领券的优惠券 */
    requestCardList: function () {
      var that = this;
      request.get('/api/activity/coupon_center', {
        data: {
          cat_id: that.result.goods.cat_id,
          goods_id: that.result.goods.goods_id
        },
        isShowLoading: false,
        success: function (res) {
          that.setData({
            cardList: res.data.result || []
          });
        }
      });
    },

    /** 领取卡券 */
    getCardList: function () {
      uni.navigateTo({
        url: '../../activity/coupon_list/coupon_list?type=goodsinfo'
      });
    },

    /** 预览图片 */
    previewCommentImgs: function (e) {
      var imgs = this.comments[e.currentTarget.dataset.cidx].img;
      uni.previewImage({
        current: imgs[e.currentTarget.dataset.id],
        urls: imgs
      });
    },

    /** 预览图片 */
    previewGoodsCommentImgs: function (e) {
      var that = this;
      var imgs = this.data.comment[e.currentTarget.dataset.cidx].img;
      imgs = imgs.map(function (val) {
        return that.url + val;
      });
      uni.previewImage({
        current: imgs[e.currentTarget.dataset.id],
        urls: imgs
      });
    },

    /** 关闭优惠信息弹窗 */
    closePromModal: function () {
      this.setData({
        openPromModal: false
      });
    },

    /** 打开优惠信息弹窗 */
    openPromModalFun: function () {
      this.setData({
        openPromModal: true
      });
    },
    // 打开分享
    catchShare: function () {
      var that = this;
      that.setData({
        share_btn: true
      });
      var query = uni.createSelectorQuery(); //选择class

      var height = 0;
      query.select('.share-containter').boundingClientRect(function (rect) {
        height = rect.height;
        var animation = uni.createAnimation({
          duration: 500,
          timingFunction: 'ease'
        });
        console.log(height);
        animation.translate(0, -height).step();
        that.setData({
          ani: animation.export()
        });
      }).exec();
    },
    // 关闭分享  js css                                                                
    share_cancel: function () {
      this.setData({
        share_btn: false
      });
    },
    listenerActionSheet: function (e) {
      this.setData({
        actionSheetHidden: !this.actionSheetHidden
      });
    },

    /**
     * 获取商品分享海报
     */
    getSharePic: function () {
      var that = this;
      uni.showLoading({
        title: '正在生成',
        mask: true
      });
      var item_id = that.data.goods.spec_goods_price.length > 0 ? that.data.goods.spec_goods_price[that.specSelect].item_id : 0;
      uni.getImageInfo({
        src: that.url + '/api/goods/goodsSharePoster?id=' + that.data.goods.goods_id + '&item_id=' + item_id + '&prom_id=' + that.data.goods.prom_id + '&prom_type=' + that.data.goods.prom_type + '&leader_id=' + uni.getStorageSync('app:userInfo')['user_id'],
        success: function (res) {
          that.setData({
            share_btn: true,
            share_pic: res.path,
            share_btn: false,
            actionSheetHidden: !that.actionSheetHidden
          });
        },
        complete: function (res) {
          uni.hideLoading();
        }
      });
    },
    closeShareModal: function () {
      this.setData({
        share_btn: false
      });
    },
    saveSharePic: function () {
      var that = this;
      uni.authorize({
        scope: 'scope.writePhotosAlbum',
        success: function (res) {
          uni.saveImageToPhotosAlbum({
            filePath: that.share_pic,
            success: function (res) {
              that.setData({
                share_btn: false,
                actionSheetHidden: !that.actionSheetHidden
              });
              uni.showToast({
                title: '保存成功',
                duration: 2000
              });
            }
          });
        },
        fail: function (res) {
          common.checkAuthorize('scope.writePhotosAlbum');
        }
      });
    },
    previewSharePic: function () {
      uni.previewImage({
        urls: [this.share_pic]
      });
    }
  }
};
</script>
<style>
/* goodsInfo.wxss */
 
page{
   background-color:#f5f5f5;
}
.container{
  padding-top: 80rpx;
}
.cup-mask{
  width:100%;
  height:100%;
  background:#000000;
  opacity:0.5;
  position:fixed;
  z-index:999;
}
.cup-title{
  font-size: 36rpx;
  font-weight: bold;
  width: 92%;
  text-align: center;
  height: 100rpx;
  line-height: 100rpx;
  margin: 0 auto;
  border-bottom: 1rpx solid #f3f3f3;
  position: relative;
}
.cup-close{
  width: 40rpx;
  height: 40rpx;
  position: absolute;
  right: 0;
  top: 30rpx;
}
.cup-close image{
  width: 100%;
  height: 100%;
}
.get-cup{
  width: 100%;
  height: 850rpx;
  background-color: #ffffff;
  position: fixed;
  bottom: 0;
  z-index: 1001;
}
image{
    vertical-align: top;
}
.flex{
    display: flex;
}
.type-navbar{
    display: flex;
    justify-content: center;
    width: 100%;
    height: 80rpx;
    background-color: #fff;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 999;
}
.type-box{
    width: 25%;
    box-sizing: border-box;
    font-size: 28rpx;
    line-height: 76rpx;
    padding: 0 20rpx;
    text-align: center;
    display: inline-block;
    overflow: hidden;
}
.type-navbar-item{
    border-bottom: 4rpx solid #fff;
}
.type-item-on{
  color: #ff6a00;
  border-bottom: 4rpx solid #ff6a00;
}
.swiper_box {
    width: 100%;
    height: 750rpx;
}
.goods-title{
    display: flex;
    justify-content: space-between;
    padding:14rpx 0 0 20rpx;
    height: 108rpx;
    position: relative;
}
.goods-info{
    background-color: #ffffff;
}
.goods-name{
    width:704rpx;
    height:80rpx;
    line-height:40rpx;
    font-size:30rpx;
    color:#1d1d1d;
    font-weight:bold;
}
.goods-collect{
    padding-top:12rpx;
}
.collect-img{
    width: 48rpx;
    height: 48rpx;
    margin: 0 auto;
    overflow: hidden;
}
.collect-des{
    text-align: center;
    font-size: 22rpx;
    color: #666;
}
.goods-price{
    font-size: 30rpx;
    line-height: 40rpx;
    color: #999;
    padding-bottom: 10rpx;
    padding-left:20rpx;
}
.prom-info{
    color:#ff6a00;
    font-size:26rpx;
    background-color:#ff6a00;
    height:72rpx;
    position:absolute;
    width:750rpx;
    top:758rpx;
}
.prom-info>.prom-type{
    color:white;
    padding:5rpx 10rpx;
    margin-left:15rpx;
    font-size:26rpx;
    margin-right: 10rpx;
    line-height:72rpx;
}
.prom-info view{
    display:inline-block;
    color: #fff;
    line-height: 72rpx;
    margin-right:20rpx;
}
.prom-info .prom-type:last-child{
  margin-left: 0;
}
.market-price{
    display: flex;
    font-size: 22rpx;
    line-height: 55rpx;
    margin-left: 6rpx;
    float: left;
    margin-top: -5rpx;
    color: #999;
    width: 700rpx;
    align-items:center;
    justify-content:space-between;
}
.logistics-list{
  padding: 0 20rpx;
  width: 750rpx;
}
.goods-num{
    display: flex;
    justify-content: space-between;
}
.logistics-item{
    display: flex;
    align-items: center;
    height: 90rpx;
    font-size: 26rpx;
    color: #666;
    justify-content: space-between;
    padding: 0;
    /* width: 750rpx; */
}
.logistics-item-price-ladder{
    word-wrap:break-word;
    width:100%;
    display: inline-block;
    margin-top:8rpx;
    font-size: 24rpx;
    color: #666;
    position: relative;
}
.logistics-item-price-ladder .man{
    padding:4rpx 8rpx;
    float: left;
    border:solid 1rpx #ff3939;
    color:#ff6a00;
    margin-right:.213rem;
    font-size:20rpx;
    border-radius:4rpx;
    margin-top:18rpx;
}
.item-title{
    width: 100rpx;
}
.tit{
    float:left;
    height:82rpx;
    line-height:82rpx;
    width:112rpx;
    border-radius:3rpx;
}
.item-mes{   
    height: 90rpx;
    line-height: 90rpx;
    overflow:hidden;
    white-space:nowrap;
    text-overflow:ellipsis;
    width: 570rpx;
    color:#1f1f1f;
}
.promotion-item-mes{   
    color: #333;
    font-size:.55rem;
    width: 600rpx;
    white-space:nowrap;
    text-overflow:ellipsis;   
    margin-top:2rpx; 
}
.promotion-item-mes-card{   
    color: #333;
    font-size:.55rem;
    width: 550rpx;  
    text-overflow:ellipsis;    
    margin-left:-16rpx;
}
.promotion-item-mes-card view{
    display: inline-block;
    margin-right:10rpx;
}
.promotion-item-mes-cardborder{
    border: solid 1rpx #ff3939;
    color: #ff6a00;
    border-radius: 3px;
    font-size: 20rpx;
    height: 28rpx;
    padding: 4rpx 8rpx;
}
.promotion-item-mes-border{
    background-color: #ff6a00;
    border-radius:4px;
    color:#ffffff;
    padding: 5rpx 8rpx;
    font-size: 22rpx;
}
.prom_detail{
    margin-left:20rpx;
    color:#666666;
    font-size:22rpx;
    white-space:nowrap;
    text-overflow:ellipsis;
    display:inline-block;
    width: 412rpx;
    line-height: 24rpx;
    overflow: hidden;
}
.item-img{
    width: 24rpx;
    height: 24rpx;
    padding-left:6rpx;
    margin-top:4rpx;
}
.prom-item {
    color: #ff6a00;
    border: 1px solid #ff6a00;
    border-radius: 18rpx;
    line-height: 40rpx;
    height: 40rpx;
    padding: 2rpx 8rpx;
}
.guarantee{
    justify-content:space-around;
}
.ico-item{
    width: 32rpx;
    height: 32rpx;
    margin-right: 10rpx;
}
.guarantee>view{
    display: flex;
    align-items: center;
    height: 32rpx;
    color: #666;
}
.user-comment{
    font-size: 26rpx;
    padding: 0 20rpx;
    border-top:16rpx solid #f3f3f3;
}
.good-comment,.comment-num{
    display: flex;
    color: #1f1f1f;
    font-size: 26rpx;
}
.evaluation {
    font-size:30rpx;
    color:#333;
    font-weight:600;
}
.evaluation text{
    color: #999;
    font-size: 22rpx;
    font-weight:500;
    margin-left:14rpx;
}
.good-comment{
    line-height:22rpx;
    color:#999;
    font-size:22rpx;
}
.good-comment .co-red{
    padding-left: 10rpx;
    color:#ff6a00;
    font-weight:500;
}
.good-comment .item-img{
    width:22rpx;
    height:22rpx;
    padding-left:8rpx;
    margin-top:0;
}
.asking{
  line-height: 80rpx;
  padding-bottom: 10rpx;
}
.asking .asktitle{
  font-weight: 600;
}
.asking .asktitle>text:nth-child(1){
    color: #333;
}
.asking .asktitle view{
    color: #ff6a00;
    float: right;
}
.asking .asktitle image{
  width: 22rpx;
  height: 22rpx;
  margin-top: 26rpx;
  margin-left: 10rpx;
}
.asking .problem>view{
    display: flex;
    justify-content: space-between;
    line-height: 50rpx;
}
.asking .problem .left{
    width: 580rpx;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.asking .problem .left text{
    background: #ff6a00;
    margin-right: 10rpx;
    padding: 2rpx;
    color: #fff;
    font-size: 24rpx;
}
.asking .problem .right{
    color: #999;
    font-size: 22rpx;
}
.co-red{
  text-align: left;
  font-weight: bold;
  color:#ff6a00;
}
.estimate .star_on image{
    width: 18rpx;
    height:18rpx;
    margin-right: 8rpx;
    margin-top: 14rpx;
}
.estimate{
    padding:10rpx 20rpx 20rpx 20rpx;
    background: #fff;
    position: relative;
}
.estimate .user_img{
    width: 76rpx;
    height:76rpx;
    position: absolute;
    border-radius:50%;
}
.estimate .user{
    padding-left: 110rpx;
}
.estimate .star_on text{
    color: #333;
    font-size: 26rpx;
}
.estimate .star_on text:nth-child(1){
    margin-right: 22rpx;
    max-width:220rpx;
    display:inline-block;
    white-space:nowrap;
    text-overflow:ellipsis;
    overflow:hidden;
}
.estimate .star_on .time{
    font-size: 24rpx;
    color:#999;
    float: right;
    margin-top: 10rpx;
}
.estimate_img image{
    width: 110rpx;
    height:110rpx;
    margin-right: 16rpx;
}
.estimate_content{
    font-size: 24rpx;
    color:#333;
    line-height: 36rpx;
    display: inline-block;
    margin-top: 10rpx;
}
.estimate .user{
    border-bottom: 2rpx solid #f3f3f3;
    padding-bottom: 27rpx;
}
.estimate .estimate_img{
    margin-top: 20rpx;
}
.recommend-ul{
    overflow:hidden;
    padding: 0 10rpx;
}
.recommend{
    background-color: #fff;
    border-top:16rpx solid #f3f3f3;
}
.recommend-title{
    height: 80rpx;
    line-height: 88rpx;
    font-size: 26rpx;
    padding: 0 20rpx;
    color: #000000;
    font-weight: bold;
}
.logistics-list .logistics-item{
    height: 70rpx;
}
.recommend-ul .li{
    width: 230rpx;
    box-sizing: border-box;
    font-size: 28rpx;
    color: #333;
    display: inline-block;
    margin-left:10rpx;
    border: 2rpx solid #fff;
    margin-bottom: 10rpx;
    overflow: hidden;
}
.recommend-ul .li .co-red{
    font-size: 20rpx;
    padding-left:10rpx;
}
.collocation-li-title{
    margin: 10rpx 0;
}
.collocation-li-title-price{
    background-color:#ff6a00;
    color:white;
    margin-left:92px;
    padding:4rpx;
    font-size:26rpx;
    border-radius:10rpx;
    min-width:10rpx;
    text-align:center;
    margin-top:8rpx;
}
.collocation-mar-left{
    margin-left:11px;
}
.collocation .li{
    height:200rpx;
    padding:20rpx;
    width:50%;
    box-sizing:border-box;
    font-size:28rpx;
    color:#333;
    display:inline-block;
}
.collocation-li-img{
    width: 160rpx;
    height: 160rpx;
    margin: 0 auto;
    float:left;
}
.ellipsis-2{
  text-align: left;
}
.li-img{
    width: 226rpx;
    height: 226rpx;
    margin: 0 auto;
}
.li-title{
  margin-top: 15rpx;
  width: 216rpx;
  font-size: 22rpx;
  text-align: left;
  padding-left: 10rpx;
  padding-bottom: 4rpx;
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow:ellipsis;
}
.comment-item{
    background-color: #fff;
    font-size: 28rpx;
    margin:0 20rpx;
    padding: 20rpx;
    border-radius: 10rpx;
    margin-bottom: 20rpx;
}

.comment-title{
    display: flex;
    justify-content: space-between;
    height: 102rpx;
    color: #999;
    font-size:24rpx;
}
.comment-title .time{
    margin-top: 4rpx;
}
.user-name{
    display: flex;
    color:#333;
    font-size:26rpx;
}
.user-pic{
    width: 76rpx;
    height: 76rpx;
    margin-right: 15rpx;
    border-radius:50%;
    overflow: hidden;
}
.user-word{
    display: inline-block;
    max-width: 185rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stars{
    float: left;
    display: flex;
    height: 42rpx;
    line-height: 42rpx;
    width: 180rpx;
    margin-top:6rpx;
    margin-left:23rpx;
}
.star{
    width:18rpx;
    height:18rpx;
    margin-right:8rpx;
}
.comment-cont{
    padding: 0 30rpx 20rpx 90rpx;
    margin-top:-60rpx;
}
.comment-mes{
    line-height: 42rpx;
    display: flex;
    width: 100%;
    margin-top: 20rpx;
}
.img-ul{
    display: flex;
    flex-wrap: wrap;
}
.img-li{
    width: 120rpx;
    height: 120rpx;
    margin:8rpx 16rpx 8rpx 0;
}
.comment-btn{
    height: 60rpx;
    padding: 20rpx 30rpx;
}
.comment-btn .btn{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60rpx;
    width: 45%;
    border: 1px solid #f3f3f3;
}
.comment-btn .btn-img{
    width: 30rpx;
    height: 28rpx;
    margin: 0 10rpx;
}
.reply-ul{
    margin-top: 20rpx;
}
.reply-li{
    color: #aaa;
}
.join-cart{
    position: fixed;
    left: 0;
    bottom: 0;
    display: flex;
    width: 100%;
    height: 98rpx;
    background-color: #fff;
    text-align: center;
    border-top: 2rpx solid #f3f3f3;
}
.cart-ico{
    font-size: 22rpx;
    color: #666;
}

.cs-img{
    width: 48rpx;
    height: 48rpx;
    margin-top: 8rpx;
}
.flex_bottom{
    display:flex;
    justify-content: space-around;
    width: 270rpx;
    padding: 0 30rpx;
}
.cs-button{
    border: 1rpx solid #fff;
    height:112rpx;
    line-height: 45rpx; 
}
.cs-button .cs-ing-name{
    font-size:22rpx;
    color:#666 !important; 
    margin-top:-4rpx;
}
.cs-button::after{ border: none; } 
.sc-img{
    width: 48rpx;
    height: 48rpx;
    margin-top: 14rpx;
}
.cart-num{
    position: absolute;
    left: 34%;
    top: 6rpx;
    width: 40rpx;
    height: 40rpx;
    line-height: 40rpx;
    text-align: center;
    border-radius: 50%;
    color: #fff;
    background-color: rgba(217,81,99,0.9);
}
.cart-btn{
    font-size: 26rpx;
    color: #fff;
    line-height: 95rpx;
    height: 100rpx;
}
.join-btn{
    background-color: #ffb03f;
    width: 210rpx;
}
view.cart-btn-lg{
    width: 420rpx !important;
}
.buy-btn{
    background-color: #ff6a00;
    width: 210rpx !important;
}
.toTop{
    position: fixed;
    z-index: 3;
    right: 20rpx;
    bottom: 160rpx;
    width: 68rpx;
    height: 68rpx;
    border:1px solid #f3f3f3;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}
.comment-more{
    height: 56rpx;
    line-height: 56rpx;
    font-size: 26rpx;
    color: #999;
    text-align: center;
    background-color: #eee;
}
.goods-more{
    background-color: #fff;
}
/* 详情 */
.goods-norms{
    background-color: #fff;
}
.type-navbar2{
    display: flex;
    height: 72rpx;
    border-top:1px solid #f3f3f3;
    border-bottom:1px solid #f3f3f3;
}
.type-box2{
    width:50%;
    font-size: 26rpx;
    line-height: 72rpx;
    text-align: center;
    overflow: hidden;
}
.type-item2-on{
    color: #ff6a00;
}
.parameter{
    padding: 40rpx 0;
}
.table{
    width: 698rpx;
    margin: 0 auto;
    border:1px solid #f3f3f3;
    border-bottom: none;
}
.tb{
    width: 100%;
    min-height: 69rpx;
    line-height: 69rpx;
    border-bottom:1px solid #f3f3f3;
    font-size: 28rpx;
    text-align:center; 
    color: #333;
}
.th-thitle{
    font-weight: bold;
    background-color:#f5fafe; 
}
.td-cont{
    display: flex;
}
.td-title{
    width: 259rpx;
    background-color:#f5fafe; 
    border-right:1px solid #f3f3f3;
}   
.td-text{
    width: 439rpx;
}
/* 评论 */

.type-navbar3{
    display: flex;
    height: 88rpx;
    border-top:1px solid #ddd;
    border-bottom:1px solid #f3f3f3;
    background: #fff;
    margin-bottom: 20rpx;
}
.type-box3{
    background: #fff;
    font-size: 24rpx;
    line-height: 44rpx;
    height: 44rpx;
    overflow: hidden;
    border-radius: 6rpx;
    border: 1px solid #ff6a00;
    color: #333;
    margin: 20rpx 10rpx;
}
.type-box3 view{
  padding: 0 10rpx;
}
.type-item3-on{
    background: #ff6a00;
    color: #fff;
}
/* 规格弹框 */
.spec-model{
    position: fixed;
    top: 100vh;
    z-index: 1000;
    background: white;
    width: 100%;
    padding: 0 30rpx;
    font-size: 32rpx;
    box-sizing: border-box;
    overflow-x: hidden;
}
.spec-goods{
    padding: 15rpx 0 20rpx;
    float: left;
    width: 100%;
    border-bottom: 1px solid #f3f3f3;
}
.ad-goods{
  padding: 0;
}
.spec-img{
  width: 180rpx;
  height: 180rpx;
  float: left;
}
.spec-goods-info{
    float: left;
    padding: 0 25rpx; 
    width: 430rpx;
}
.spec-goods-name{
    font-size: 30rpx;
    line-height: 35rpx;
    height: 70rpx;
    margin: 15rpx 20rpx 25rpx 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1c1c1c;
}
.spec-goods-price{
    color: #ff6a00;
    font-size: 36rpx;
    font-weight: bold;
    text-align: left;
}
.money-icon{
    font-size: 30rpx;
    float: left;
    line-height: 62rpx;
}
.spec-goods-stock{
    margin-top: 10rpx;
    font-size: 26rpx;
    color: #999;
    margin-bottom:10rpx;
    float: right;
}
.spec-box{
    width: 100%;
    height: 50rpx;
    overflow: hidden;
    margin-top: 50rpx;
}
.spec-name{
    float: left;
    width: 150rpx;
    font-size: 32rpx;
}
.count{
    float: right;
    width: 184rpx;
    height: 50rpx;
    font-size: 32rpx;
    font-weight: bold;
}
.count>view,.count>input{
    float: left;
    width: 60rpx;
    height: 50rpx;
    line-height: 50rpx;
    text-align: center;
}

.spec-btn{
    color: black;
    background-color: #efefef;
    font-size: 24rpx;
    line-height: 48rpx;
    float: left;
    height: 48rpx;
    padding: 0 24rpx;
    border: 1rpx solid #f3f3f3;
    margin: 4rpx 20rpx 4rpx 0;
    border-radius: 24rpx;
    max-width: 240rpx;
    display: block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow:ellipsis;
}
.spec-btn-click{
    color: #ff3a3a;
    background-color: #ffefef;
    border: 1rpx solid #ff6a00;
}
.spec_types{
  width: 100%;
  height: auto;
  overflow: hidden;
  padding-top: 20rpx;
}

.spec-cart-btns{
  margin: 20rpx -30rpx 0;
  padding: 20rpx 34rpx;
  float: left;
  width: 100%;
  line-height: 80rpx;
}
.spec-cart-btn{
    float: left;
    width: 690rpx;
    font-size: 30rpx;
    text-align: center;
    color: white;
    border-radius: 50rpx;
    background-color: #ff6a00;
}
.spec-add-cart{
    background-color: #ff6a00;
}
.spec-buy{
    background-color: #ff6a00;
}
.spec-cart-disable{
    background: #bbbbbb;
}
/* .spec-cart-btn-lg{
    width: 614rpx;
} */
/* 优惠信息弹框 */
.prom-model{
    position: fixed;
    bottom: 0;
    z-index: 1000;
    background: white;
    width: 100%;
    padding: 0 30rpx 30rpx;
    font-size: 32rpx;
    box-sizing: border-box;
    overflow-x: hidden;
}
.prom-model .prom-title{
    text-align: center;
    margin: 30rpx 0;
}
.prom-model .logistics-item{
    border: 0;
}
.prom-model .item-mes{
    width: 500rpx;
}
.integral-btn{
    width: 100%;
    padding: 0rpx;
    margin: 0rpx;
}
/* 分享 */
.share-select{

  width:750rpx;
  height:445rpx;
  background:rgba(255,255,255,1);
  border-radius:20rpx 20rpx 0px 0px;
  color: #333;
  font-size: 30rpx;
  z-index: 999;
}
.share-containter{
    position: fixed;
  bottom: 0;
  /* top: 100vh; */
background: #fff;
z-index: 1000;
/* position: absolute; */
width: 750rpx;
border-radius: 20rpx 20rpx 0 0;

}
.share-containter .share-content{
  display: flex;
  height: 245rpx;
}
.share-select .share-tit{
  height:100rpx;
  line-height: 100rpx;
  text-align: center;
  background:rgba(245,245,245,1);
  border-radius:20rpx 20rpx 0px 0px;
}
.share-select .shart-item{
  width: 375rpx;
  color: #666;
  font-size: 24rpx;
  text-align: center;

}
.action-sheet::after{   
    border: none;   
}
.share-select .shart-item view{
  height: 36rpx;
  line-height: 36rpx;
}
.share-select .share-content image{
  width: 120rpx;
  height: 120rpx;
  margin-top: 40rpx;

}
.share-select .share-cancel{
  border-top:2rpx solid #E6E6E6;
  background: #fff;
  border-radius: 0;
}
.posters-model{

  border-radius:20rpx;
margin: 0 75rpx;
position: fixed;
top: 50%;
transform: translate(0,-50%);
width: 600rpx;
z-index: 9999;

}
.posters-model image{
  width: 600rpx;
  border-radius: 20rpx;
}
.posters-model .save-image{
  width:400rpx;
  height:80rpx;
  line-height: 80rpx;
  text-align: center;
  border:2rpx solid rgba(255,255,255,1);
  border-radius:40rpx;
  background: transparent;
  color: #fff;
  font-size: 30rpx;
  margin: 40rpx auto 0;
}
/*预约商品详情*/
.book_label{ width:100%; padding:20rpx  20rpx 20rpx 20rpx; background: #ffffff;}
.book_label .book_price .b.span{ font-size:16pt; color:#ff2828; font-weight:bold; margin-right:0.64rem;}
.book_label .book_price .span{ font-size:28rpx; color:#999;}
.book_label .book_price .span .i{ text-decoration:line-through;}
.book_label .book_peop{ 
  font-size:10pt; 
  color:#333; 
  margin-top:0.64rem;
}
.book_label .book_peop .span{ margin-top:0.213334rem;}
.book_label .book_peop .span .i{ color:#ff2828;}
.book_label .book_peop .em{ color:#00c4e7;
border:1px solid #00c4e7;
width:160rpx;
text-align:center;
height:45rpx;
line-height:50rpx;
border-radius:30rpx;
float:right;
position:relative;
bottom:20rpx;
right:30rpx;
margin-top:7px;
margin-right: 20rpx;
}
.book_storinf{ width:100%; background: #ffffff;  margin-top:0.426667rem; padding: 0rpx  0rpx 20rpx 20rpx; border-bottom:1px solid #dedede; border-top:1px solid #f3f3f3;}

.book_storinf_item {
  display: flex;
  flex-direction: row;
  align-content: space-between;
  padding: 20rpx 0;
  height: auto;
  font-size:10pt;
}

.book_storinf_item label {
  display: block;
  color: #999;
  width: 200rpx;
  
}

.book_storinf_item .span{
  display: block;
  width: 500rpx;
}

.book-sec-item{
    color:#00c4e7;
    display: flex;
    flex-direction: row;
    justify-content: start;
    flex-wrap: wrap;
    
}


/* 商品海报分享*/

.share-btn {
    display: inline-block;
    margin-top: 12rpx;
    margin-left: 12rpx;
    height:44rpx;
    width:44rpx;
    color:#666;
    font-size:20rpx;
    position:absolute;
    right:22rpx;
    top:84rpx;
}

.share-btn image{
    width: 100%;
    height: 100%;
}

.share-save-btns{
    background-color: #fff;
    width: 100%;
    line-height: 80rpx;
}

.share-save-btn {
    width: 80%;
    height: 80rpx;
    text-align: center;
    margin: 0px auto;
    background-color: #ff6a00;
    color: #fff;
    border-radius: 10rpx;
}

.share-pic {
    width: 270rpx;
    height: 480rpx;
    margin: 20rpx auto ;
    background-color: #999;
    box-shadow: 0rpx 5rpx 5rpx 5rpx #cccccc
}

.share-tips {
    font-size: 9pt;
    color: #999;
    display: block;
    margin-top: 10rpx;
    width: 100%;
    text-align: center;
}

.action-sheet-btn{
    width: 100%;
    height: 100%;
    margin: -10px 0;
    font-size: 18px;
}

.action-sheet-btn::after{   
    border: none;   
}
.bargin_head_pic{
    width: 1rem;
    height:1rem;
    margin-left: -15rpx;
    border-radius: 50%;
    border:4px #fff solid 
}
.bargin_headpic{
    margin-top:32rpx;
    width: 300rpx;
}

.classname{
    margin-top:-21px;
    font-size:.6777rem;
    color:#fff;
}
.wxParse-p image{
  width: 100%!important;
}
.co-red-price{
  font-size: 56rpx;
  font-weight: bold;
  float: left;
  width: 85%;
  padding-bottom:10rpx;
}
/* 优惠券 */
.coupon-list{
    margin-bottom: 80rpx;
}
.coupon-box {
    width:100%;
    float:left;
    font-size:25rpx;
    height:172rpx;
    padding:0 30rpx;
    margin-top:27rpx;
}
.coupon-head {
    border-image:none 100% 0 5 repeat;
    width:250rpx;
    height:174rpx;
    float:left;
    position:relative;
}
.coupon-body {
    padding:30rpx 0rpx 10rpx 30rpx;
    color:#999999;
    width:440rpx;
    float:right;
    box-sizing:border-box;
    border:1rpx solid #f3f3f3;
}
.line-adt {
    text-align:left;
    font-size:26rpx;
    color:#333333;
}
.line {
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    line-height:32rpx;
    text-align:center;
    font-size:22rpx;
}
.use-end {
    background-color:#f8f8f8;
    font-size:22rpx;
    display:inline-block;
    margin-top:30rpx;
}
.use-btn {
    border:2rpx solid #ff6a00;
    padding:6rpx 35rpx;
    border-radius:35rpx;
    width:fit-content;
    float:right;
    margin-top:20rpx;
    margin-right:15rpx;
}
/* 价格处理 */
.sbj{
  min-width: 5rpx;
  float: left;
}
.icon2{
  margin-top: -4rpx;
}



</style>